
# dump方法
"""
dump() : 将python对象转化为json文件
"""

import json

data = {
  "name": "John",
  "age": 30,
  "city": "北京",
  "is_work": False,
  "card": None
}

# 通过dump写入json
with open('test_data1.json','w',encoding='utf-8') as f:
    json.dump(data,f,ensure_ascii=False)